#include <cstdio>


/**
 * 有向带权图的邻接矩阵
 * 
 */
int main(){
	// 点的最大数量
	const int MAX_NODES = 11;

	int graph[MAX_NODES][MAX_NODES]{};

	int nodes = 5;

	int edges[6][3] = {
		//1指向2,权重为3
		{1,2,3},
		//2指向1,权重为3
		{2,1,3},
		//2指向3,权重为5
		{2,3,5},
		//3指向5,权重为1
		{3,5,1},
		//4指向5,权重为8
		{4,5,8},
		//5指向1,权重为6
		{5,1,6}
	};

	for(int i = 0; i < 6; i++) {
		graph[edges[i][0]][edges[i][1]] = edges[i][2];
	}


	printf("有向带权图的邻接矩阵遍历:\n");

	for (int i = 0; i <= nodes; i++) {
		for (int j = 0; j <= nodes; j++) {
            printf("%d ", graph[i][j]);
		}
		printf("\n");
	}

    return 0;

}